﻿@model EditBlogPostViewModel

@section styles{
    @Styles.Render("~/Content/bootstrap-select.css")
}

@{
    string returnListUrl = ViewBag.ReturnListUrl;
    SelectList blogCategoryDDL = ViewBag.BlogCategoryDDL;

    ViewBag.Title = "Bài đăng blog " + Model.Name;
}

<section class="content-header">
    <h1>
        Bài đăng blog
        <small>@Model.Name</small>
    </h1>
    <ol class="breadcrumb">
        <li>
            <a href="@Url.Action("Index", "Home")">
                <i class="fa fa-home"></i> Trang chủ
            </a>
        </li>
        <li>
            <a href="@Url.Action("Index", "BlogPost")">
                Danh sách bài đăng blog
            </a>
        </li>
        <li class="active">@Model.Name</li>
    </ol>
</section>
<section class="content">
    @using (Html.BeginForm("Edit", "BlogPost", FormMethod.Post, new { id = "frmEditPost", enctype = "multipart/form-data" }))
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true)
        @Html.HiddenFor(m => m.Id)
        @Html.Hidden("ReturnListUrl", returnListUrl)

        <div class="box box-solid">
            <div class="box-body">
                <div class="row">
                    <div class="col-md-5">
                        <div class="form-group">
                            @Html.LabelFor(m => m.BlogCategoryId, new { @class = "control-label" })
                            @Html.DropDownListFor(m => m.BlogCategoryId, blogCategoryDDL, "Chọn danh mục blog",
                            new
                            {
                                @class = "selectpicker no-margin",
                                data_width = "100%",
                                data_size = "auto",
                                data_live_search = "true"
                            })
                            @Html.ValidationMessageFor(m => m.BlogCategoryId)
                        </div>
                        <div class="form-group">
                            @Html.LabelFor(m => m.Name, new { @class = "control-label" })
                            @Html.TextAreaFor(m => m.Name, new { @class = "form-control" })
                            @Html.ValidationMessageFor(m => m.Name)
                        </div>
                    </div>
                    <div class="col-md-7">
                        <div class="form-group">
                            @Html.LabelFor(m => m.Description, new { @class = "control-label" })
                            @Html.TextAreaFor(m => m.Description, new { @class = "form-control" })
                            @Html.ValidationMessageFor(m => m.Description)
                        </div>
                    </div>
                </div>
            </div>
            <div class="box-footer text-right">
                <a href="@(returnListUrl ?? Url.Action("Index", "BlogPost"))" class="btn btn-default pull-left">
                    <i class="fa fa-chevron-left fa-mr"></i> Back to List
                </a>
                <button type="reset" class="btn btn-warning">
                    <i class="fa fa-refresh fa-mr"></i> Refresh
                </button>
                <button type="submit" class="btn btn-success">
                    <i class="fa fa-check fa-mr"></i> Xác nhận
                </button>
            </div>
        </div>
    }
</section>

@section scripts{
    @Scripts.Render("~/Scripts/bootstrap-select.js")
    <script>
        ActiveMenu('#blogPost-menu');

        $('.selectpicker').selectpicker

        $('#frmEditBlogPost').data("validator").settings.ignore = "";
    </script>
    @Scripts.Render("~/Scripts/ckeditor/ckeditor.js")
    <script>
        CKEDITOR.replace('Description');
    </script>
}